<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
    <title>ZuiLib接口文档</title>
    <link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>

<div id="container">

<div id="product">
	<div id="product_logo"></div>
	<div id="product_name"><big><b></b></big></div>
	<div id="product_description"></div>
</div> <!-- id="product" -->


<div id="main">


<!-- Menu -->

<div id="navigation">
<br/>
<h1>zui</h1>




<h2>Topics</h2>
<ul class="">
  <li><strong>readme</strong></li>
  <li><a href="../topics/layout.md.html">layout</a></li>
</ul>
<h2>Classes</h2>
<ul class="nowrap">
  <li><a href="../index.html">Control</a></li>
</ul>

</div>

<div id="content">


<h1>ZuiLib</h1>
<p>ZuiLib是一款跨平台的高性能界面库，底层使用sdl2进行控件渲染，部分控件代码实现参考了duilib的实现（这里感谢duilib作者）。</p>

<h3>特性</h3>

<ol>
    <li>跨平台支持Windows，Mac OS X，Linux，iOS &amp; Android等平台。</li>
    <li>使用xml进行布局（布局兼容duilib布局），多种控件支持。</li>
    <li>lua面向对象接口封装，以及多种lua扩展可供使用（http请求，lua自绘控件，lua系统原生线程，luasqlite3,luacjson,luasocket等）。</li>
    <li>简易的事件绑定机制，很容易处理各种控件事件。</li>
    <li>高性能，底层支持OpenGL，DirectX硬件渲染，支持脏矩形双缓存机制，提高界面性能。</li>
    <li>支持容器自动适应子控件尺寸。</li>
</ol>

<h3>示例</h3>

<p>main.lua</p>


<pre>
<span class="keyword">local</span> HelloWorld= class(zui.Window)

<span class="keyword">function</span> HelloWorld:ctor()
    <span class="comment">--创建窗口并显示
</span> self:createWindow(<span class="string">"HelloWorld"</span>,self.POS_CENTER,self.POS_CENTER,<span class="number">300</span>,<span class="number">200</span>)
<span class="keyword">end</span>

<span class="keyword">function</span> HelloWorld:onInit()
    self:loadLayout(<span class="string">"layout/hello_world.xml"</span>)
<span class="keyword">end</span>

<span class="comment">--绑定按钮的事件
</span><span class="keyword">function</span> HelloWorld:quit()
    zui.Application.instance():quit()
<span class="keyword">end</span>

helloWorldWnd = HelloWorld.new()
</pre>


<p>hello_world.xml</p>


<pre>
&lt;?xml version=<span class="string">"1.0"</span> encoding=<span class="string">"UTF-8"</span>?&gt;
&lt;Window caption=<span class="string">"0,36,0,0"</span> sizebox=<span class="string">"3,3,3,3"</span>&gt;
    &lt;Font name=<span class="string">"default_font"</span> size=<span class="string">"13"</span> file=<span class="string">"font/msyh.ttc"</span> default=<span class="string">"true"</span>/&gt;

    &lt;VLayout bkcolor=<span class="string">"gainsboro"</span> bordercolor=<span class="string">"#ff007acc"</span> bordersize=<span class="string">"1"</span> inset=<span class="string">"1,1,1,1"</span>&gt;
        &lt;Label height=<span class="string">"25"</span> text=<span class="string">"Hello World"</span>/&gt;
        &lt;Button text=<span class="string">"退出"</span> bkcolor=<span class="string">"red"</span> textcolor=<span class="string">"white"</span> hottextcolor=<span class="string">"yellow"</span> width=<span class="string">"150"</span> height=<span class="string">"30"</span> onClick=<span class="string">"quit"</span>/&gt;
    &lt;/VLayout&gt;
&lt;/Window&gt;
</pre>




</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-06-06 11:42:56 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>
